# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Alex Yam <alex@alexyam.com>
pkgname=inspircd
pkgver=3.16.1
pkgrel=0
pkgdesc="internet relay chat daemon (ircd)"
url="https://www.inspircd.org/"
pkgusers="inspircd"
pkggroups="inspircd"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	argon2-dev
	gnutls-dev
	libpq-dev
	mariadb-dev
	openldap-dev
	pcre2-dev
	perl
	re2-dev
	sqlite-dev
	"
subpackages="$pkgname-doc"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/inspircd/inspircd/archive/v$pkgver.tar.gz
	re2-cxx-std.patch
	"

# secfixes:
#   3.10.0-r0:
#     - CVE-2021-33586

build() {
	./configure \
		--enable-extras "argon2 ldap mysql pgsql regex_pcre2 regex_posix regex_re2 regex_stdlib sqlite3 ssl_gnutls sslrehashsignal"
	./configure \
		--binary-dir /usr/bin \
		--data-dir /var/lib/inspircd/data \
		--example-dir /usr/share/inspircd/examples \
		--module-dir /usr/lib/inspircd/modules \
		--script-dir /usr/lib/inspircd/scripts \
		--disable-auto-extras \
		--distribution-label alpine$pkgrel \
		--gid inspircd \
		--uid inspircd \
		--system
	INSPIRCD_DISABLE_RPATH=1 make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
2b488858b0012bcb3eb92a33960e9927c861587c7b7451a47fd3e10a97fad9c392524d98712593fd455c5cbae7fd1779e4b90b9e55680c2f36b483e0acf2bba5  inspircd-3.16.1.tar.gz
9f8a13ef6d2bd1e8c6ea7b6c8b24f127e4170be78fc41ac029db32c75eca3c32a5c3ada803e0ab712cfd3f2bb69f843e9f166adab178a8cfed172d4a77382978  re2-cxx-std.patch
"
